package com.demo.server.service;

import java.util.List;

import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.demo.server.entity.Region;
import com.demo.server.mapper.RegionMapper;
import com.demo.server.util.ResultData;

@Service
public class RegionService {
	@Autowired
	RegionMapper regionMapper;
	
	/**
	 * @title 列出次级地区
	 * @param pCode
	 * @return
	 */
	public ResultData<List<Region>> listByPCode(String pCode){
		if(StringUtils.isEmpty(pCode)) {
			pCode = "0";
		}
		List<Region> regions = regionMapper.selectByPCode(pCode);
		return ResultData.success(regions);
	}
}
